import szkstoolState from "./store/szkstoolState";
import map3DUtils from "./utils/map3DUtils";
import button from "./packages/button"; //按钮
import extrudePolygon from "./packages/extrudePolygon"; //矿权盒子
import foldPanel from "./packages/foldPanel"; //左右折叠面板
import popup from "./packages/popup"; //弹出框
import mapToolbar from "./packages/mapToolbar"; //工具条
import decorateBox from "./packages/decorateBox"; //模块框
import list from "./packages/list"; //模块框
import VideoCalibra from "./packages/videoCalibra"; //视频校准

const components = {
  szksButton: button,
  szksExtrudePolygon: extrudePolygon,
  szksLeftFoldPanel: foldPanel.leftFoldPanel,
  szksRightFoldPanel: foldPanel.rightFoldPanel,
  szksPopup: popup,
  szksMapToolbar: mapToolbar.mapToolbar,
  szksTopRightPanel: mapToolbar.TopRightPanel,
  szksDecorateBox: decorateBox.box1,
  szksItemList: list.itemList,
  szksDataList: list.dataList,
  szksScrollList: list.scrollList,
  szksVideoCalibra: VideoCalibra,
};

const install = function (Vue) {
  Object.keys(components).forEach((key) => {
    Vue.component(key, components[key]);
  });
};

const createStore = function (Vue, Vuex, options) {
  options = options || { modules: {} };
  if (options.modules === undefined) {
    options.modules = {};
  }
  options.modules["szkstoolState"] = szkstoolState;
  Vue.use(Vuex);
  return new Vuex.Store(options);
};

const resister = function (store) {
  if (store !== null) {
    store.registerModule("szkstoolState", szkstoolState);
  }
};

export default {
  install,
  createStore,
  resister,
  map3DUtils: map3DUtils,
};
